package com.jia.lidao.network.http.request.impl;

import com.jia.lidao.Constans;
import com.jia.lidao.enity.OrderlistRespDTO;
import com.jia.lidao.network.http.request.AbstractRequest;
import com.lidroid.xutils.http.client.HttpRequest;

import org.apache.http.Header;

import java.lang.reflect.Type;
import java.util.List;

/**
 * Created by jia on 17/12/17.
 */

public class OrderListRequest extends AbstractRequest {

    private int page;

    private int status;

    private int type;

    public OrderListRequest(int page,int status,int type){
        this.page=page;
        this.status=status;
        this.type=type;
    }

    @Override
    public String getUrl() {
        if(type==1) {
            return Constans.BASEURL + "/orders/agent";
        }else{
            return Constans.BASEURL+"/orders/agent/mine";
        }
    }

    @Override
    public void initRequestParams() {
        addParam("page",String.valueOf(page));
        addParam("status",status+"");
        addParam("page_size","20");
    }

    @Override
    public List<Header> getHeaders() {
        return null;
    }

    @Override
    public Type getResultType() {
        return OrderlistRespDTO.class;
    }

    @Override
    public HttpRequest.HttpMethod getRequestMethod() {
        return HttpRequest.HttpMethod.GET;
    }
}
